package com.shanling.shanlingcontroller.utils;

import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.DisplayMetrics;
import android.view.WindowManager;

import com.shanling.shanlingcontroller.CustomApplication;

/**
 * Created by ch1 on 2019/9/27.
 */

public class PhoneUtils {
    /**
     * 获取当前手机系统版本号
     *
     * @return  系统版本号
     */
    public static String getSystemVersion() {

        return android.os.Build.VERSION.RELEASE;
    }


    /**
     * 获取手机型号
     *
     * @return  手机型号
     */
    public static String getSystemModel() {
        return android.os.Build.MODEL;
    }


    public static int getWindowWidth(){
// 获取屏幕分辨率
        WindowManager wm = (WindowManager) (CustomApplication.getInstance().getSystemService(Context.WINDOW_SERVICE));
        DisplayMetrics dm = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(dm);
        int mScreenWidth = dm.widthPixels;
        return mScreenWidth;
    }
    public static int getWindowHeigh(){
// 获取屏幕分辨率
        WindowManager wm = (WindowManager) (CustomApplication.getInstance().getSystemService(Context.WINDOW_SERVICE));
        DisplayMetrics dm = new DisplayMetrics();
        wm.getDefaultDisplay().getMetrics(dm);
        int mScreenHeigh = dm.heightPixels;
        return mScreenHeigh;
    }



}
